﻿/************************************************************************************
 * 漠然(459699936@qq.com) 2015/1/9 15:18:35
 ************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Justin.Service
{
    interface IService
    {

        /// <summary>
        /// 将插件加入容器进行集中管理
        /// </summary>
        /// <param name="service"></param>
        /// <returns></returns>
        bool Register(IServiceCell service);

        /// <summary>
        /// 将插件移除容器
        /// </summary>
        /// <param name="service"></param>
        /// <returns></returns>
        bool Remove(IServiceCell service);


        /// <summary>
        /// 使用接口进行创建
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        T GetService<T>(params object[] args);

        /// <summary>
        /// 使用对象的GUID进行创建
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="guid"></param>
        /// <returns></returns>
        T GetServiceByGuid<T>(Guid guid, params object[] args);

        /// <summary>
        /// 使用名字进行创建
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name">插件名字属性</param>
        /// <returns></returns>
        T GetServiceByName<T>(string name, params object[] args);
    }
}
